/*
package org.itboys.core.controller.front;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.itboys.commons.CommonConstants;
import org.itboys.core.entity.mongo.SundayKnowledgeBase;
import org.itboys.core.service.mongo.front.SundayFrontKnowledgeBaseService;
import org.itboys.core.util.ResponseMessage;
import org.itboys.framework.spring.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

*/
/**
 * Auther: 罗尧坤
 * Date: 2018/8/3
 * Description:
 *//*

@Controller
@RequestMapping("/sunday/small/knowledgeBase")
@Api(value = "knowledgeBase",description = "知识库")
public class SundayFrontKnowledgeBaseController extends BaseController {
    @Autowired
    private SundayFrontKnowledgeBaseService knowledgeBaseService;

    @RequestMapping(value="/select", method= {RequestMethod.POST})
    @ApiOperation(value="小程序 分页获取知识库")
    public void select(
            HttpServletRequest request,
            HttpServletResponse response,
            @ApiParam(required = true, name = "pageSize", value = "分页参数。每页数量。默认20")
            @RequestParam(value = "pageSize", required = true) String pageSize
            ,
            @ApiParam(required = true, name = "pageNumber", value = "分页参数。第几页。默认1")
            @RequestParam(value = "pageNumber", required = true) String pageNumber
            ,
            @ApiParam(required = false, name = "sort", value = "排序参数。字段名称。默认为空。")
            @RequestParam(value = "sort", required = false) String sort
            ,
            @ApiParam(required = false, name = "order", value = "排序参数。默认为空。ASC正序/DESC倒序")
            @RequestParam(value = "order", required = false) String order
    ){
        try{
            List<SundayKnowledgeBase> result =knowledgeBaseService.select(request);
            ResponseMessage.success(result);
        }catch (Exception e){
            String msg = CommonConstants.ERROMSG;
            Integer code=CommonConstants.FAIL_CODE;
            //自定义异常（签名错误）
            if(e.getClass().getSimpleName().equalsIgnoreCase("ErrorException")){
                msg=e.getMessage();
                //token已过期
            }else  if(e.getClass().getSimpleName().equalsIgnoreCase("TokenException")){
                code=CommonConstants.TOKEN_CODE;
                msg=CommonConstants.TOKENMSG;
            }else{
                logger.error("/sunday/small/knowledgeBase/select----e="+e.getMessage());
            }
            e.printStackTrace();
            ResponseMessage.error(code,msg);
        }
    }

    @RequestMapping(value="/getDetail", method= {RequestMethod.POST})
    @ApiOperation(value="小程序 分页获取知识库")
    public void select(
            HttpServletRequest request,
            HttpServletResponse response,
            @ApiParam(required = true, name = "id", value = "知识库Id")
            @RequestParam(value = "id", required = true) Long id
    ){
        try{
            SundayKnowledgeBase result =knowledgeBaseService.getDetail(id);
            ResponseMessage.success(result);
        }catch (Exception e){
            String msg = CommonConstants.ERROMSG;
            Integer code=CommonConstants.FAIL_CODE;
            //自定义异常（签名错误）
            if(e.getClass().getSimpleName().equalsIgnoreCase("ErrorException")){
                msg=e.getMessage();
                //token已过期
            }else  if(e.getClass().getSimpleName().equalsIgnoreCase("TokenException")){
                code=CommonConstants.TOKEN_CODE;
                msg=CommonConstants.TOKENMSG;
            }else{
                logger.error("/sunday/small/knowledgeBase/getDetail----e="+e.getMessage());
            }
            e.printStackTrace();
            ResponseMessage.error(code,msg);
        }
    }

}
*/
